package com.fm.openinstall.a;

import android.content.*;
import android.content.pm.*;
import android.os.*;

import java.util.*;
import java.security.*;

public class a {
    public static String a(final Context p0) {
        //
        // This method could not be decompiled.
        //
        // Original Bytecode:
        //
        //     1: invokevirtual   android/content/Context.getApplicationInfo:()Landroid/content/pm/ApplicationInfo;
        //     4: getfield        android/content/pm/ApplicationInfo.sourceDir:Ljava/lang/String;
        //     7: astore_0
        //     8: new             Ljava/io/RandomAccessFile;
        //    11: dup
        //    12: aload_0
        //    13: ldc             "r"
        //    15: invokespecial   java/io/RandomAccessFile.<init>:(Ljava/lang/String;Ljava/lang/String;)V
        //    18: invokevirtual   java/io/RandomAccessFile.getChannel:()Ljava/nio/channels/FileChannel;
        //    21: astore_0
        //    22: aload_0
        //    23: invokestatic    com/fm/openinstall/d/b.a:(Ljava/nio/channels/FileChannel;)Lcom/fm/openinstall/d/a;
        //    26: astore_1
        //    27: aload_1
        //    28: ifnonnull       42
        //    31: aload_0
        //    32: ifnull          39
        //    35: aload_0
        //    36: invokevirtual   java/nio/channels/FileChannel.close:()V
        //    39: ldc             ""
        //    41: areturn
        //    42: aload_1
        //    43: invokevirtual   com/fm/openinstall/d/a.c:()[B
        //    46: astore_1
        //    47: aload_1
        //    48: ifnonnull       62
        //    51: aload_0
        //    52: ifnull          59
        //    55: aload_0
        //    56: invokevirtual   java/nio/channels/FileChannel.close:()V
        //    59: ldc             ""
        //    61: areturn
        //    62: new             Ljava/lang/String;
        //    65: dup
        //    66: aload_1
        //    67: bipush          10
        //    69: invokestatic    android/util/Base64.encode:([BI)[B
        //    72: ldc             "UTF-8"
        //    74: invokespecial   java/lang/String.<init>:([BLjava/lang/String;)V
        //    77: astore_1
        //    78: aload_0
        //    79: ifnull          86
        //    82: aload_0
        //    83: invokevirtual   java/nio/channels/FileChannel.close:()V
        //    86: aload_1
        //    87: areturn
        //    88: astore_1
        //    89: goto            95
        //    92: astore_1
        //    93: aconst_null
        //    94: astore_0
        //    95: aload_0
        //    96: ifnull          103
        //    99: aload_0
        //   100: invokevirtual   java/nio/channels/FileChannel.close:()V
        //   103: aload_1
        //   104: athrow
        //   105: aconst_null
        //   106: astore_0
        //   107: aload_0
        //   108: ifnull          115
        //   111: aload_0
        //   112: invokevirtual   java/nio/channels/FileChannel.close:()V
        //   115: aconst_null
        //   116: areturn
        //   117: aconst_null
        //   118: astore_0
        //   119: aload_0
        //   120: ifnull          127
        //   123: aload_0
        //   124: invokevirtual   java/nio/channels/FileChannel.close:()V
        //   127: aconst_null
        //   128: areturn
        //   129: astore_0
        //   130: goto            117
        //   133: astore_0
        //   134: goto            105
        //   137: astore_1
        //   138: goto            119
        //   141: astore_1
        //   142: goto            107
        //   145: astore_0
        //   146: ldc             ""
        //   148: areturn
        //   149: astore_0
        //   150: ldc             ""
        //   152: areturn
        //   153: astore_0
        //   154: aload_1
        //   155: areturn
        //   156: astore_0
        //   157: goto            103
        //   160: astore_0
        //   161: aconst_null
        //   162: areturn
        //   163: astore_0
        //   164: aconst_null
        //   165: areturn
        //    Exceptions:
        //  Try           Handler
        //  Start  End    Start  End    Type
        //  -----  -----  -----  -----  -------------------------------
        //  8      22     129    119    Ljava/io/FileNotFoundException;
        //  8      22     133    107    Ljava/io/IOException;
        //  8      22     92     95     Any
        //  22     27     137    141    Ljava/io/FileNotFoundException;
        //  22     27     141    145    Ljava/io/IOException;
        //  22     27     88     92     Any
        //  35     39     145    149    Ljava/io/IOException;
        //  42     47     137    141    Ljava/io/FileNotFoundException;
        //  42     47     141    145    Ljava/io/IOException;
        //  42     47     88     92     Any
        //  55     59     149    153    Ljava/io/IOException;
        //  62     78     137    141    Ljava/io/FileNotFoundException;
        //  62     78     141    145    Ljava/io/IOException;
        //  62     78     88     92     Any
        //  82     86     153    156    Ljava/io/IOException;
        //  99     103    156    160    Ljava/io/IOException;
        //  111    115    160    163    Ljava/io/IOException;
        //  123    127    163    166    Ljava/io/IOException;
        //
        // The error that occurred was:
        //
        // java.lang.IndexOutOfBoundsException: Index: 99, Size: 99
        //     at java.util.ArrayList.rangeCheck(ArrayList.java:657)
        //     at java.util.ArrayList.get(ArrayList.java:433)
        //     at com.strobel.decompiler.ast.AstBuilder.convertToAst(AstBuilder.java:3321)
        //     at com.strobel.decompiler.ast.AstBuilder.build(AstBuilder.java:113)
        //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:211)
        //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:99)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethodBody(AstBuilder.java:782)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethod(AstBuilder.java:675)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addTypeMembers(AstBuilder.java:552)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeCore(AstBuilder.java:519)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeNoCache(AstBuilder.java:161)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createType(AstBuilder.java:150)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addType(AstBuilder.java:125)
        //     at com.strobel.decompiler.languages.java.JavaLanguage.buildAst(JavaLanguage.java:71)
        //     at com.strobel.decompiler.languages.java.JavaLanguage.decompileType(JavaLanguage.java:59)
        //     at us.deathmarine.luyten.DecompilerLinkProvider.generateContent(DecompilerLinkProvider.java:97)
        //     at us.deathmarine.luyten.OpenFile.decompileWithNavigationLinks(OpenFile.java:494)
        //     at us.deathmarine.luyten.OpenFile.decompile(OpenFile.java:467)
        //     at us.deathmarine.luyten.Model.extractClassToTextPane(Model.java:413)
        //     at us.deathmarine.luyten.Model.openEntryByTreePath(Model.java:339)
        //     at us.deathmarine.luyten.Model$TreeListener$1.run(Model.java:266)
        //
        throw new IllegalStateException("An error occurred while decompiling this method.");
    }

    public static String a(final Context context, final String s) {
        final Object o = null;
        while (true) {
            try {
                final ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128);
                Object value = o;
                if (applicationInfo != null) {
                    final Bundle metaData = applicationInfo.metaData;
                    value = o;
                    if (metaData != null) {
                        value = metaData.get(s);
                    }
                }
                if (value == null) {
                    return "";
                }
                return String.valueOf(value);
            } catch (PackageManager.NameNotFoundException ex) {
                final Object value = o;
                continue;
            }
            break;
        }
    }

    public static String b(final Context context) {
        try {
            final byte[] digest =
                    MessageDigest.getInstance("SHA1").digest(context.getPackageManager().getPackageInfo(context.getPackageName(), 64).signatures[0].toByteArray());
            final StringBuilder sb = new StringBuilder();
            for (int i = 0; i < digest.length; ++i) {
                final String upperCase = Integer.toHexString(digest[i] & 0xFF).toUpperCase(Locale.US);
                if (upperCase.length() == 1) {
                    sb.append("0");
                }
                sb.append(upperCase);
                sb.append(":");
            }
            final String string = sb.toString();
            return string.substring(0, string.length() - 1);
        } catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException ex) {
            return null;
        }
    }

    public static String c(final Context context) {
        try {
            return String.valueOf(context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode);
        } catch (PackageManager.NameNotFoundException ex) {
            return "0";
        }
    }
}
